#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define sld(n) scanf("%lld",&n)
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
const int N = 2e5;
#define INF 0x7fffffff
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//
//全排
int a[N + 10];
void solve()
{
	int n, k;
	sd(n); sd(k);
	for (int i = 1; i <= n; i++) sd(a[i]);
	int ordered = 0;
	for (int i = 1; i <= n; i++)
	{
		if (a[i] == 1) ordered = 1;
		else if (a[i] ==ordered + 1) ++ordered;
	}
	int num = (n - ordered) / k;
	if ((n - ordered) % k>=1) pd(num + 1);
	else pd(num);
	puts("");
}

int main()
{
	int T;
	sd(T);
	while (T--)
	{
		solve();
	}
	return 0;
}